package com.zhai.test.trigger;

import com.alibaba.fastjson.JSON;
import com.zhai.trigger.dto.RaffleAwardListRequestDTO;
import com.zhai.trigger.dto.RaffleAwardListResponseDTO;
import com.zhai.trigger.dto.RaffleStrategyRuleWeightRequestDTO;
import com.zhai.trigger.dto.RaffleStrategyRuleWeightResponseDTO;
import com.zhai.trigger.http.RaffleStrategyController;
import com.zhai.types.model.Response;
import lombok.extern.slf4j.Slf4j;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Description: 抽奖策略外部测试类
 * @ClassName: RaffleStrategyControllerTest
 * @Author: zhaiyongxin
 * @Date: 2025/3/27 15:49
 * @Version: 1.0
 */
@SpringBootTest
@RunWith(SpringRunner.class)
@Slf4j
public class RaffleStrategyControllerTest {

    @Resource
    private RaffleStrategyController raffleStrategyController;

    @Test
    public void test_queryRaffleAwardList() {
        RaffleAwardListRequestDTO request = new RaffleAwardListRequestDTO();
        request.setUserId("zhaiyongxin");
        request.setActivityId(100301L);

        Response<List<RaffleAwardListResponseDTO>> response = raffleStrategyController.queryRaffleAwardList(request);

        log.info("请求参数：{}", JSON.toJSONString(request));
        log.info("测试结果：{}", JSON.toJSONString(response));
    }

    @Test
    public void test_queryRaffleStrategyRuleWeight() {
        RaffleStrategyRuleWeightRequestDTO request = new RaffleStrategyRuleWeightRequestDTO();
        request.setUserId("zhaiyongxin");
        request.setActivityId(100301L);

        Response<List<RaffleStrategyRuleWeightResponseDTO>> response = raffleStrategyController.queryRaffleStrategyRuleWeight(request);

        log.info("请求参数：{}", JSON.toJSONString(request));
        log.info("测试结果：{}", JSON.toJSONString(response));
    }
}
